package com.nit.generate;

import com.nit.tools.loop.NitLoopTools;

import java.util.Random;

/**
 * qq号码 生成器
 *
 * @Auth: 逆天开源-逍遥哥哥
 * @link: 1715656022@qq.com
 * @Date: 2023-07-11
 */
public class NitQQGenerator {

    public static void main(String[] args) {
        NitLoopTools.loop(4, () -> {
            String tmp = NitQQGenerator.generate();
            System.out.println("随机QQ:" + tmp + "<br>");
        });
    }

    public static String generate() {
        return generateRandomQQNumber(NitNumberGenerator.generateInt(6, 12));
    }

    public static String generateRandomQQNumber(Integer length) {
        Random random = new Random();
        StringBuilder sb = new StringBuilder();
        // QQ号码的第一位不能为0
        sb.append(random.nextInt(9) + 1);
        NitLoopTools.loop(length - 1, () -> {
            sb.append(random.nextInt(10));
        });
        return sb.toString();
    }


}